package com.axjy.dao;

import com.axjy.pojo.House;
import org.springframework.data.domain.Example;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

public interface HouseDao extends JpaRepository<House,Integer>{

    @Query(value="select h from House h join fetch h.street s join fetch s.district where h.user.id=?1",
    countQuery = "select count(h.id) from House h join h.street s join  s.district where h.user.id=?1")
    Page<House> findByUserId(Integer id,Pageable pageable);


}
